package bz.ziro.kanbe.controller.file;

import java.util.logging.Logger;
import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

import bz.ziro.kanbe.dao.SiteFileDao;
import bz.ziro.kanbe.model.SiteFile;

/**
 * ダウンロードコントローラー
 * @author Administrator
 */
public class DownloadController extends Controller {

    @SuppressWarnings("unused")
    private static final Logger logger = Logger.getLogger(DownloadController.class.getName());

    @Override
    public Navigation run() {
        String keyBuf = requestScope("fileKey");
        SiteFile file = SiteFileDao.find(Long.valueOf(keyBuf));
        //ダウンロードを行う
        download(file.getName(), file.getFile());
        return null;
    }
}
